package com.ysd.lis.controller.sys;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.request.EventLogPageParam;
import com.ysd.lis.request.ExceptionalLogPageParam;
import com.ysd.lis.service.SysEventLogService;
import com.ysd.lis.service.SysExceptionalLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * SYS_EVENT_LOG 前端控制器
 * </p>
 *
 * @author Bai
 * @since 2023-11-06
 */
@Api(tags = "日志系统")
@RestController
public class SysEventLogController extends BaseController {

    @Autowired
    SysEventLogService sysEventLogService;
    @Autowired
    SysExceptionalLogService exceptionalLogService;

    @ApiOperation("分页获取日志信息")
    @PostMapping("/api/log/getPageLogging")
    public Result getPageLogging(@RequestBody EventLogPageParam eventLogPageParam ) {
        return sysEventLogService.getPageLogging(eventLogPageParam);
    }



    @ApiOperation("根据主键获取日志详情信息")
    @GetMapping("/api/log/getLoggingById/{id}")
    public Result getLoggingById(@PathVariable("id") String id ) {

        return Result.succ(sysEventLogService.getById(id));
    }


    @ApiOperation("分页获取异常日志信息")
    @PostMapping("/api/log/getPageExceptionalLogging")
    public Result getPageExceptionalLogging(@RequestBody ExceptionalLogPageParam exceptionalLogPageParam ) {
        return exceptionalLogService.getPageExceptionalLogging(exceptionalLogPageParam);
    }


    @ApiOperation("根据主键获取日志异常详情信息")
    @GetMapping("/api/log/getExceptionalLogById/{id}")
    public Result getExceptionalLogById(@PathVariable("id") String id ) {

        return Result.succ(exceptionalLogService.getById(id));
    }

}
